/**
 * Copyright &copy; 2012-2017 <a href="https://vivo.com">vivo</a> All rights reserved.
 */
package com.vivo.retail.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.vivo.retail.entity.ViDeaRetailorder;
import com.vivo.retail.dao.ViDeaRetailorderDao;

/**
 * 新的零售单Service
 * @author jyangye
 * @version 2018-04-10
 */
@Service
@Transactional(readOnly = true)
public class ViDeaRetailorderService extends CrudService<ViDeaRetailorderDao, ViDeaRetailorder> {

    @Autowired
    private ViDeaRetailorderDao viDeaRetailorderDao;

	public ViDeaRetailorder get(String id) {
		return super.get(id);
	}

	public ViDeaRetailorder getLast(ViDeaRetailorder viDeaRetailorder) {
	    return viDeaRetailorderDao.getLastChangeData(viDeaRetailorder);
    }
	
	public List<ViDeaRetailorder> findList(ViDeaRetailorder viDeaRetailorder) {
		return super.findList(viDeaRetailorder);
	}
	
	public Page<ViDeaRetailorder> findPage(Page<ViDeaRetailorder> page, ViDeaRetailorder viDeaRetailorder) {
		return super.findPage(page, viDeaRetailorder);
	}


	@Transactional(readOnly = false)
    public void insertByBatch(List<ViDeaRetailorder> orderList, String area) {
	    if (area.equals("ah")) {
	        viDeaRetailorderDao.insertByBatchAh(orderList);
        } else {
	        viDeaRetailorderDao.insertByBatchAh(orderList);
        }
    }
	
	@Transactional(readOnly = false)
	public void save(ViDeaRetailorder viDeaRetailorder) {
		super.save(viDeaRetailorder);
	}
	
	@Transactional(readOnly = false)
	public void delete(ViDeaRetailorder viDeaRetailorder) {
		super.delete(viDeaRetailorder);
	}
	
}